import http from '@src/util/HttpUtil';
const fixedPrefix = '';
/* ------------- start 事件类型设置 ---------------- */
/** 获取服务事件类型列表*/
export const getEventTypeList = (params = {}) => {
  return http.get(`${fixedPrefix}/event/setting/eventType/list`, params)
}

/** 新建服务事件类型*/
export const addEventType = (params = {}) => {
  return http.post(`${fixedPrefix}/event/setting/eventType/create`, params)
}

/** 启(禁)用服务事件类型*/
export const enableEventType = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/eventType/enable`, params, false)
}

/** 删除服务事件类型*/
export const deleteEventType = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/eventType/delete`, params, false)
}

/** 服务事件类型列表排序*/
export const orderWithEventTypeList = (params = {}) => {
  return http.post(`${fixedPrefix}/event/typeOrder/update`, params)
}

/** 事件类型表单设置|获取表单字段*/
export const getEventFieldList = (params = {}) => {
  return http.get(`${fixedPrefix}/event/setting/eventType/field/getList`, params)
}

/** 事件类型表单设置|获取公共字段*/
export const getEventCommonFieldList = (params = {}) => {
  return http.get(`${fixedPrefix}/event/setting/eventType/field/getEventCommonFieldList`, params)
}

/** 事件类型表单设置|字段升级(为公共)/降级(为私有)*/
export const setEventTypeCommonField = (params = {}) => {
  return http.post(`${fixedPrefix}/event/setting/eventType/field/setCommonFields`, params)
}

/** 事件类型表单设置|保存*/
export const saveEventTypeField = (params = {}) => {
  return http.post(`${fixedPrefix}/event/setting/eventType/field/save`, params)
}

/** 事件类型表单设置|获取已打开状态附加组件列表*/
export const getEnabledEventTypeCardList = (params = {}) => {
  return http.get(`${fixedPrefix}/setting/serviceStation/card/getEnabledList`, params)
}

/** (事件类型表单设置|附加组件列表)|获取系统模板库列表*/
export const getSystemTemplateList = (params = {}) => {
  return http.get(`${fixedPrefix}/setting/card/getSysList`, params)
}
/**
 * @description 保存事件新建表单
 * @param {Object} 
 */
export const saveEventFields = (params = {}) => {
  return http.post('/setting/eventFieldInfo/save', params)
}

/** 删除事件表单和事件回执表单字段 */
export const deleteEventField = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/eventFieldInfo/delete`, params, false)
}


/**
 * @description 获取事件表单数据
 * @param {Object} params-- params
 * @param {String} params.typeId -- 类型id
 * @param {String} params.tableName -- event:事件表单字段 event_receipt:事件回执表单字段
 * @param {String} params.isFromSetting -- 用于设置页全部显示，不用于设置页，则通过可见性和隐藏性来过滤字段(true不过滤，false过滤)
 */
export const getEventTemplateFields = (params = {}) => {
  return http.get('/setting/getEventTemplateFieldList', params)
}

/**
 * @description 更新事件类型的流程审批的相关配置
 * @param {Object} 
 */
export const saveEventTypeProcess = (params = {}) => {
  return http.post('/event/setting/eventType/saveEventTypeProcess', params)
}

/* ------------- end 事件类型设置 ---------------- */

/** 附加组件列表 */
export const getEventCardList = (params = {}) => {
  return http.get(`${fixedPrefix}/setting/serviceStation/cardManage/getEventCardList`, params)
}

/** 附加组件列表 */
export const getAllCardList = (params = {}) => {
  return http.get('/event/setting/getAllCardList', params)
}

/** 附加组件列表|拖拽排序 */
export const updateCardOrderId = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/serviceStation/cardManage/updateCardOrderId`, params)
}

/** 附加组件列表|组件状态设置*/
export const setCardStatus = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/serviceStation/card/enabled`, params, false)
}

/** 附加组件列表|单个附加组件信息获取*/
export const getCardInfo = (params = {}) => {
  return http.get(`${fixedPrefix}/setting/serviceStation/card/getOne`, params)
}

/** 附加组件列表|新增附加组件*/
export const addCard = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/serviceStation/card/create`, params)
}

/** 附加组件列表|删除附加组件*/
export const deleteCard = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/serviceStation/card/delete`, params, false)
}

/** 附加组件列表|从模板库导入附加组件*/
export const addCardWithTemplate = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/card/import`, params, false)
}

/** 附加组件列表|单个附加组件信息修改*/
export const updateCardInfo = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/serviceStation/card/update`, params, )
}

/** 附加组件列表|使用统计查看*/
export const getCardCount = (params = {}) => {
  return http.get(`${fixedPrefix}/setting/card/count`, params)
}

/** 事件类型表单设置|(获取当前类型数据/获取当前类型使用的附加组件列表)*/
export const getEventTypeData = (params = {}) => {
  return http.get(`${fixedPrefix}/setting/eventType/getOne`, params)
}

/** 事件类型表单设置|选择添加附加组件*/
export const selectAddEventTypeCard = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/eventType/cardSelect`, params, false)
}

/** 事件类型表单设置|从模板库中添加附加组件(关联事件类型和附加组件)*/
export const addEventTypeCardWithTemplate = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/eventType/card/addCard`, params, false)
}

/** 事件类型表单设置|删除附加组件(取消该类型和附加组件关系链)*/
export const deleteEventTypeCard = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/eventType/deleteCard`, params, false)
}

/** 保存附加组件*/
export const saveEventTypeCard = (params = {}) => {
  return http.post(`${fixedPrefix}/event/setting/eventType/batchSaveEventCard`, params)
}

/** 检查校验附加组件是否必填*/
export const checkNotNullForCard = (params = {}) => {
  return http.get(`${fixedPrefix}/event/checkNotNullForCard`, params)
}

/** (事件类型表单设置/附加组件列表)|获取附加组件fields */
export const getEventTypeCardFields = (params = {}) => {
  return http.get(`${fixedPrefix}/setting/serviceStation/cardField/list`, params)
}

/** 附加组件表单设计器|获取附加组件fields (包含可见性) */
export const getCardFieldList = (params = {}) => {
  return http.get(`${fixedPrefix}/setting/serviceStation/cardField/queryCardFieldList`, params)
}

/** 附加组件表单设计器|保存附加组件表单字段 */
export const createBatch = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/serviceStation/cardField/createBatch`, params)
}

/** 附加组件表单设计器|删除附加组件表单字段 */
export const deleteEventCardField = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/serviceStation/cardField/delete`, params, false)
}

/** 事件类型表单设置|附加组件排序 */
export const orderWithCardList = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/saveEventCardOrder`, params)
}

/** 事件类型表单设置|保存附加组件 */
export const batchSaveEventCard = (params = {}) => {
  return http.post('/event/setting/eventType/batchSaveEventCard', params)
}

/** 事件类型表单设置|获取角色列表*/
export const getRoleList = (params = {}) => {
  return http.get(`${fixedPrefix}/setting/role/list`, params)
}

/** 事件类型表单设置|保存附加组件角色权限*/
export const saveCardPremiss = (params = {}) => {
  return http.post(`${fixedPrefix}/setting/eventType/cardAuth`, params, false)
}

export const getEventCardFieldList = (params = {}) => {
  return http.get(`${fixedPrefix}/setting/cardManage/getEventCardFieldList`, params)
}
